<template>
  <el-dialog
    title=""
    v-if="visible"
    :visible.sync="visible"
    :width="(drillDownDialogData.width+40)+'px'"
    :close-on-click-modal="false"
    @close="drillDownDialogClose"
  >
    <div>
      <drill-down-chart :dragchartdata="drillDownDialogData" page="view"></drill-down-chart>
    </div>

    <!--
    <span slot="footer" class="dialog-footer">
      <el-button @click="drillDownDialogClose">取 消</el-button>
      <el-button type="primary" @click="drillDownDialogClose">确 定</el-button>
    </span>
    -->
  </el-dialog>
</template>

<script>
import DrillDownChart from './drillDownChart.vue';
import DrillDownRightPanel from './drillDownRightPanel.vue';
export default {
  name: "drillDownDialog",
  components: {DrillDownRightPanel, DrillDownChart},
  props: {
    drillDownDialogFlag: {
      default: false,
    },
    drillDownDialogData: {
      type: Object
    },
  },
  data() {
    return {
      visible: false,
    };
  },
  created() {

  },
  mounted() {
     
  },
  methods: {
    drillDownDialogClose() {
      this.$emit("update:drillDownDialogFlag", false);
    },
    
  },
  watch: {
    drillDownDialogFlag() {
      this.visible = this.drillDownDialogFlag;
      if(this.drillDownDialogFlag){
         this.$nextTick(() => {

          document.getElementsByClassName('el-dialog__wrapper')[0].firstChild.style.background = this.drillDownDialogData.drillBgColor;
         
          if(this.drillDownDialogData.x != -1 || this.drillDownDialogData.y != -1){
            document.getElementsByClassName('el-dialog__wrapper')[0].firstChild.style.margin = 0;
            document.getElementsByClassName('el-dialog__wrapper')[0].firstChild.style.left = this.drillDownDialogData.x + 'px';
            document.getElementsByClassName('el-dialog__wrapper')[0].firstChild.style.top = this.drillDownDialogData.y + 'px';

          }
        });
      }
      
    },
    
  },
};
</script>

<style lang="scss" scoped>

.drill-board {
  width: 900px;
  height: 600px;
  border: 1px solid #409eff;
  background-color: #2c3437;
}

</style>